<?php
/**
 * RUBIK IT Solution & Development Co.ltd,
 *
 * PROJECT		: Auction
 * COPYRIGHT	: 2010
 * ------------------------------------------------------
 *
 * ViewDTO class of  #__user table
 *
 * @author			haunhp <haunhp@rubik.com.vn>
 * @access			public
 * @package			dbo.MemberDTO
 *
 * Created on	: October 03, 2010
 */

// Importer
RCoreImporter::cls( "dbo.AbstractDTO" );

/**
 * 
 * The table for exporting owner list
 */
class OwnerExportViewDTO extends AbstractDTO {

	var $business_name	= "S||u";
	var $user_id		= "N*||u|key";
	var $fullname		= "S*||u";
	var $address		= "S*||u";
	var $email	 		= "EM*||u";
	var $contact_tel	= "S*||u";
	var $user_group_code= "S*||u";
	var $live_auction	= "B|0|u";
	var $date_join		= "D*|NOW|u";
	var $last_upload_date	= "D||a|create_date";
	
	/**
	 * Constructor
	 *
	 * @param string $where	 the where string (without WHERE)
	 * @param string $orderBy the other by string (with order by)
	 * @param DataBase $db the database (if null the database of system will be specify)
	 */
	function __construct($where = '', $orderBy = '', $db = null) {
		$sql = 'FROM user u	LEFT JOIN auctions a ON u.user_id = a.owner_id ';
		$oWhere = ' u.user_group_code <> "admin" AND u.deleted = 0 ';
		if(!empty($where)) {
			$where .= ' AND'.$oWhere;
		}
		else {
			$where = $oWhere;
		}
		parent::__construct($sql, $where, $orderBy, $db);
	}
}